# !/usr/bin/env python
# -*- coding:utf-8 -*-
'''网易股票财务数据查看器

历史:
    2019-05-18 姚彧 创建

Copyright (c) 2019- 姚彧. All rights reserved.
'''

import sys
import os
from PyQt5.QtWidgets import QApplication
import version
import resources
from events.EventCenter import (EventContext, EventDispatcher)
from ui.main_ui import neMainWindow
from ui.pane_output import paneOutput
from ui.pane_chart import paneChart
import matplotlib
matplotlib.rcParams['font.sans-serif'] = ['SimHei']

event_handlers = (neMainWindow,
                  paneOutput,
                  paneChart,
                  )



def my_log(context:EventContext, *args, **kwargs):
    print((context, args, kwargs))

def main():
    ev = EventDispatcher()
    ev.register('*', my_log)
    app = QApplication(sys.argv)
    for handler in event_handlers:
        if hasattr(handler, 'register_events'):
            getattr(handler, 'register_events')()
    sys.exit(app.exec_())

if __name__ == '__main__':
    main()